package com.yxzc.chapter05.fun

/**
 *
 * @author wu
 * @create 2021-09-03-11:05 
 */
object FunDemo {
  def main(args: Array[String]): Unit = {
    var n1 = 10
    var n2 = 20
    println("res" + getRes(n1, n2, ')'))
    println(n1)
  }

  //定义一个函数/方法
  def getRes( n1: Int, n2: Int, oper: Char)= {

    if ('+' == oper) {
      n1 + n2
    } else if (oper == '-') {
      n1 - n2
    } else {
      null
    }

  }
}
